package com.example.mybatisPlus.plus.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.example.mybatisPlus.plus.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo> {
    @Select("select id,username,password,age from user_info where username = #{username}")
    List<UserInfo> selectListByCustom(String username);

    @Select("select id,username,password,age from user_info ${ew.customSqlSegemt}")
    List<UserInfo> selectListByCustom2(@Param(Constants.WRAPPER) Wrapper<UserInfo> wrapper);

    List<UserInfo> selectListByCustom3(@Param(Constants.WRAPPER) Wrapper<UserInfo> wrapper);

    @Update("update user_info set age= age + #{age} ${ew.customSqlSegemt}")
    Integer updateByCustom(@Param("age") Integer age,@Param(Constants.WRAPPER) Wrapper<UserInfo> wrapper);
}








































